# -*- coding: utf-8 -*-
# https://blog.csdn.net/weixin_52040868
# 公众号：测个der
# 微信：qing_an_an

from PyQt5.QtWidgets import *
import sys


class MyWin(QWidget):
    def __init__(self):
        super(MyWin, self).__init__()
        self.resize(700,200)
        # 全局控件(注意参数self)，用于承载全局布局
        wight = QWidget(self)
        # 全局布局集成全局控件
        layout = QHBoxLayout(wight)
        hlayout = QHBoxLayout()
        vlayout = QVBoxLayout()
        glayout = QGridLayout()
        flayout = QFormLayout()

        hlayout.addWidget(QPushButton(str(1)))
        vlayout.addWidget(QPushButton(str(2)))
        glayout.addWidget(QPushButton(str(3)),0,1)
        flayout.addWidget(QPushButton(str(4)))
        # 添加局部控件，将其添加到全局中
        layout.addLayout(hlayout)
        layout.addLayout(vlayout)
        layout.addLayout(glayout)
        layout.addLayout(flayout)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    my = MyWin()
    my.show()
    sys.exit(app.exec_())